<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-layout.tld" prefix="layout" %>
<%@page import="com.dfhc.util.CryptoHelper"%>
<!DOCTYPE html>
<HTML>
<HEAD>
<jsp:include page="/jsp/support/deeptree/include/globalDeepTree.jsp" />
<%@ taglib uri="/dfhc" prefix="dfhc" %>
<!-- 全局js 和css包 -->
<%@ include file="/jsp/include/web/new/global.jsp" %>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery.ztree.excheck-3.5.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/h-ui.admin/zTreeStyle/zTreeStyle.css" />

	<!--
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery.ztree.exedit-3.5.js"></script>
	-->
<SCRIPT type="text/javascript">
		<!--
		 window.onfocus = function focus(){//重写父窗口window对象中的onfocus，使其在获得焦点时执行以下代码   
			  if( typeof(window.childWindow)!="undefined"){//如果子窗口存在，将焦点转到子窗口   
			   window.childWindow.focus();   
			  }   
		 }  
		var setting = {
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick,
				onDblClick: zTreeOnDblClick				
			}
		};

		var zNodes =[
		    <c:forEach items="${beans}" var="bean" varStatus="status">
			{ id:"${bean.child_party_id}", pId:"${bean.parent_party_id}", name:"${bean.child_party_name}",
				child_party_code:"${bean.child_party_code}",url:'<%=request.getContextPath()%><%=CryptoHelper.encryptUrl(request,"/manegePartyTab/manageParty")%>?cmd=org&view_id=${view_id}&amp;child_party_code=${bean.child_party_code}&amp;party_id=', target:"operation_frame", open:false}
			,
			</c:forEach>
		];
		
		$(document).ready(function(){

			window.focus();
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		});
		
		var array = new Array();
		var myObjKeyValue = new Array(5);
		function onClick(event, treeId, treeNode, clickFlag) {
			var party_id=treeNode.id;
			$('#party_id').val(party_id);
			var party_name=treeNode.name;
			$('#party_name').val(party_name);
			var child_party_code=treeNode.child_party_code;
			$('#child_party_code').val(child_party_code);
			myObjKeyValue[0]=party_id;
			myObjKeyValue[1]=party_name;
		}
		
		function zTreeOnDblClick(event, treeId, treeNode) {
			var party_id=treeNode.id;
			$('#party_id').val(party_id);
			var party_name=treeNode.name;
			$('#party_name').val(party_name);
			var child_party_code=treeNode.child_party_code;
			$('#child_party_code').val(child_party_code);
			myObjKeyValue[0]=party_id;
			myObjKeyValue[1]=party_name;
		};
		//-->
	</SCRIPT>
</HEAD>

<body >

<dfhc:div templateId="h_ui_ztree_div"  id="treeDemo" >
</dfhc:div>

	<dfhc:input name="party_id" id="party_id" type="hidden" value="" />
	<dfhc:input name="party_name" id="party_name" type="hidden" value="" />
	<dfhc:input name="child_party_code" id="child_party_code" type="hidden" value="" />
</body>
</HTML>